import request, {uploadFile} from './request.js';

// 根据字典类型查询字典数据信息
export function getDicts (dictType) {
  return request({
    url: '/system/dict/data/type/' + dictType,
    method: 'get'
  })
}

// 附件列表
export function fileListAPI (query) {
  return request({
    url: '/file/list',
    method: 'get',
    data: query
  })
}

// 附件下载
export function fileDownloadAPI (query) {
  return request({
    url: `/file/download/${query.uploadId}`,
    method: 'get',
    responseType: 'arrayBuffer'
  }, {
    show_error: false
  })
}

// 附件上传
export function fileUploadAPI (tempFilePaths, data, file) {
  return uploadFile({
    url: '/file/upload',
		tempFilePaths,
		data,
    file,
  })
}

// 附件删除
export function removeFileAPI (params) {
  return request({
    url: `/file/remove/${params.uploadId}`,
    method: 'DELETE',
  })
}

// 获取权限验证信息
export function createJsapiSignatureAPI (query) {
  return request({
    url: '/system/wx/cp/portal/createJsapiSignature',
    method: 'get',
    data: query
  })
}
